package juc.imooccache.computable;

import java.io.IOException;

/**
 * @author fangbin
 * @desc
 * @date 2020/7/5 18:17
 */
public class MayFail implements Computable<String,Integer> {


    @Override
    public Integer compute(String arg) throws Exception {
        double random = Math.random();
        if(random>0.5){
            throw new IOException("读取文件出错");
        }
        Thread.sleep(4000);
        System.out.println(Thread.currentThread().getName()+"拿到了正确的值。。。。。。。。。。。。。。。。。。。。。。。。");
        return Integer.valueOf(arg);
    }
}
